package gulimall.controller;

import gulimall.constant.AuthServerConstant;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

/**
 * @author HLF
 * @date 2022/7/30 15:28
 */
@Controller
public class IndexController {

    @GetMapping(value = {"/", "login.html"})
    public String index(HttpSession session) {
         Object member = session.getAttribute(AuthServerConstant.LOGIN_USER);
        if (member == null) {
            return "login";
        }
        return "redirect:http://firstgulimall.com";
    }

    @GetMapping({"/reg.html"})
    public String reg() {
        return "reg";
    }

    /**
     * TODO
     * 退出登录
     */
}
